package a.f.c;

import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.k;
import a.c.*;
import a.f.*;
import a.f.l.g;
import a.f.o;
import a.f.r;
import a.i.p;
import a.i.y;

import java.awt.geom.Rectangle2D;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import a.i.p;
import a.i.y;

public class b
  extends r
{
  public static final Object g = "y.layout.grouping.FixedGroupLayoutStage.FIXED_GROUP_NODES_DPKEY";
  public static final Object h = "y.layout.grouping.FixedGroupLayoutStage.INTER_EDGES_DPKEY";
  private y i;
  private Map j;
  private Map k;
  private Map l;
  private k m;
  private k n;
  private k o;
  public static final byte p = 0;
  public static final byte q = 3;
  public static final byte r = 4;
  private byte s = 0;
  private rc t;
  public static int u;
  
  public b() {}
  
  public b(rc paramrc)
  {
    super(paramrc);
  }
  
  public void a(byte paramByte)
  {
    this.s = paramByte;
  }
  
  public byte b()
  {
    return this.s;
  }
  
  public void b(rc paramrc)
  {
    this.t = paramrc;
  }
  
  public rc c()
  {
    if (!h.j) {
      if (this.t == null) {
        this.t = d();
      }
    }
    return this.t;
  }
  
  private rc d()
  {
    g localg = new g();
    localg.b(h);
    localg.b((byte)2);
    localg.f(true);
    localg.c(4);
    localg.d(0);
    localg.c(0.8D);
    localg.i(false);
    c localc = new c();
    localc.a(false);
    return new nb(localc, localg);
  }
  
  public boolean canLayout(o paramo)
  {
    if (!h.j)
    {
      if (a() != null) {
        c(paramo);
      }
    }
    else
    {
      boolean bool = a().canLayout(paramo);
      d(paramo);
      return bool;
    }
    return true;
  }
  
  public void doLayout(o paramo)
  {
    if (!h.j)
    {
      if (a() != null) {
        c(paramo);
      }
    }
    else {
      try
      {
        a(paramo);
      }
      finally
      {
        d(paramo);
      }
    }
  }
  
  void c(o paramo)
  {
    boolean bool2 = h.j;
    boolean bool1 = h.i;
    this.i = new y(paramo);
    this.j = new HashMap();
    this.k = new HashMap();
    this.l = new HashMap();
    h localh = new h(paramo);
    k localk = paramo.c(g);
    if (!bool2) {}
    p local3 = localk != null ? localk : new p()
    {
      public Object get(Object paramAnonymousObject)
      {
        return Boolean.TRUE;
      }
      
      public boolean getBool(Object paramAnonymousObject)
      {
        return true;
      }
    };
    boolean[] arrayOfBoolean = { true };
    bb localbb1 = new bb();
    a(localh, new c_()
    {
      private final k val$isFixed;
      private final bb val$fixedGroups;
      private final boolean[] val$hasFixedGroupsOnly;
      private final h val$grouping;
      private final o val$graph;
      
      public boolean a(e paramAnonymouse)
      {
        if (!h.j)
        {
          if (this.val$isFixed.getBool(paramAnonymouse))
          {
            this.val$fixedGroups.add(paramAnonymouse);
            return true;
          }
          this.val$hasFixedGroupsOnly[0] = false;
        }
        return false;
      }
      
      public void b(e paramAnonymouse)
      {
        boolean bool2 = h.j;
        boolean bool1 = h.i;
        Object localObject1 = this.val$grouping.g(paramAnonymouse).l();
        do
        {
          do
          {
            if (!((m)localObject1).e()) {
              break;
            }
            localObject2 = ((m)localObject1).a();
            if (bool1) {
              break label151;
            }
            if (((d)localObject2).f() != paramAnonymouse)
            {
              b.this.k.put(localObject2, ((d)localObject2).f());
              localw = this.val$graph.s((d)localObject2);
              this.val$graph.a((d)localObject2, ((d)localObject2).e(), paramAnonymouse);
              this.val$graph.d((d)localObject2, localw);
            }
            ((m)localObject1).f();
          } while (!bool1);
        } while (bool2);
        localObject1 = this.val$grouping.h(paramAnonymouse).l();
        label151:
        do
        {
          if (!((m)localObject1).e()) {
            break;
          }
          localObject2 = ((m)localObject1).a();
          if (((d)localObject2).e() != paramAnonymouse)
          {
            b.this.j.put(localObject2, ((d)localObject2).e());
            localw = this.val$graph.r((d)localObject2);
            this.val$graph.a((d)localObject2, paramAnonymouse, ((d)localObject2).f());
            this.val$graph.c((d)localObject2, localw);
          }
          ((m)localObject1).f();
        } while (!bool1);
        localObject1 = this.val$grouping.d(paramAnonymouse);
        Object localObject2 = wc.a(this.val$graph, ((bb)localObject1).l());
        a.d.w localw = new a.d.w(((Rectangle2D)localObject2).getX() - this.val$graph.p(paramAnonymouse), ((Rectangle2D)localObject2).getY() - this.val$graph.q(paramAnonymouse));
        b.this.l.put(paramAnonymouse, localw);
      }
    });
    bb localbb2 = new bb();
    a.c.w localw = localbb1.l();
    while (localw.e())
    {
      localbb2.addAll(localh.d(localw.d()));
      localw.f();
      if (bool2) {
        break label237;
      }
      if (bool1) {
        break label230;
      }
      if (bool1)
      {
        if (bool2) {
          break label237;
        }
        if (!bool2) {}
        q.n = !q.n;
      }
    }
    localw = localbb2.l();
    label230:
    label237:
    if (localw.e()) {}
    do
    {
      this.i.a(localw.d());
      localw.f();
      if (bool2) {
        break label322;
      }
      if (bool1) {
        break label318;
      }
      if (!bool1) {
        break;
      }
      localh.e();
      this.o = paramo.c(i.c);
      this.m = paramo.c(i.a);
    } while (bool2);
    this.n = paramo.c(i.b);
    label318:
    label322:
    if (!bool2)
    {
      if (arrayOfBoolean[0] != 0)
      {
        paramo.j(i.c);
        paramo.j(i.a);
        paramo.j(i.b);
      }
    }
    else {
      if (!bool1) {
        break label380;
      }
    }
    if (this.o != null) {
      paramo.a(i.c, new p()
      {
        private final k c;
        private final k val$isFixed;
        
        public Object get(Object paramAnonymousObject)
        {
          return getBool(paramAnonymousObject) ? Boolean.TRUE : Boolean.FALSE;
        }
        
        public boolean getBool(Object paramAnonymousObject)
        {
          boolean bool = h.j;
          if ((bool) || (this.c.getBool(paramAnonymousObject))) {
            if (bool) {}
          }
          return !this.val$isFixed.getBool(paramAnonymousObject);
        }
      });
    }
    label380:
    if (bool2) {
      q.o = !q.o;
    }
  }
  
  void d(o paramo)
  {
    boolean bool2 = h.j;
    boolean bool1 = h.i;
    if (!bool2) {
      if (this.o != null)
      {
        paramo.a(i.c, this.o);
        this.o = null;
      }
    }
    if (!bool2)
    {
      if (this.m != null)
      {
        paramo.a(i.a, this.m);
        this.m = null;
      }
      if (bool2) {}
    }
    else if (this.n != null)
    {
      paramo.a(i.b, this.n);
      this.n = null;
    }
    this.i.g();
    h localh = new h(paramo);
    a(localh, new c_()
    {
      private final k a;
      private final o val$graph;
      private final h val$grouping;
      
      public boolean a(e paramAnonymouse)
      {
        return this.a.getBool(paramAnonymouse);
      }
      
      public void b(e paramAnonymouse)
      {
        bb localbb = this.val$grouping.d(paramAnonymouse);
        a.d.w localw = (a.d.w)b.this.l.get(paramAnonymouse);
        Rectangle2D localRectangle2D = wc.a(this.val$graph, localbb.l());
        wc.b(this.val$graph, localbb.l(), this.val$graph.p(paramAnonymouse) + localw.a - localRectangle2D.getX(), this.val$graph.q(paramAnonymouse) + localw.b - localRectangle2D.getY());
      }
    });
    n localn = paramo.C();
    Object localObject1 = this.j.keySet().iterator();
    Object localObject2;
    Object localObject3;
    do
    {
      do
      {
        if (!((Iterator)localObject1).hasNext()) {
          break;
        }
        localObject2 = (d)((Iterator)localObject1).next();
        localObject3 = paramo.r((d)localObject2);
        paramo.a((d)localObject2, (e)this.j.get(localObject2), ((d)localObject2).f());
        paramo.c((d)localObject2, (a.d.w)localObject3);
        localn.a(localObject2, true);
        if (bool2) {
          break label261;
        }
        if (bool1) {
          break label254;
        }
      } while (!bool1);
    } while (bool2);
    localObject1 = this.k.keySet().iterator();
    label254:
    do
    {
      if (!((Iterator)localObject1).hasNext()) {
        break;
      }
      localObject2 = (d)((Iterator)localObject1).next();
      localObject3 = paramo.s((d)localObject2);
      paramo.a((d)localObject2, ((d)localObject2).e(), (e)this.k.get(localObject2));
      paramo.d((d)localObject2, (a.d.w)localObject3);
      localn.a(localObject2, true);
      if (bool2) {
        break label430;
      }
      if (bool1) {
        break label426;
      }
    } while (!bool1);
    label261:
    if ((!bool2) && (!bool2))
    {
      if (this.s == 4)
      {
        localObject1 = paramo.w();
        while (((m)localObject1).e())
        {
          localObject2 = ((m)localObject1).a();
          if ((bool2) || (bool2)) {
            break label734;
          }
          if (bool1) {
            break label731;
          }
          if (localn.getBool(localObject2)) {
            wc.b(paramo, (d)localObject2);
          }
          ((m)localObject1).f();
        }
      }
      label426:
      label430:
      if (bool2) {}
    }
    else
    {
      if (this.s == 3)
      {
        localObject1 = h;
        localObject2 = paramo.c(localObject1);
        paramo.a(localObject1, localn);
        c().doLayout(paramo);
        if (!bool2) {
          if (localObject2 == null)
          {
            paramo.j(localObject1);
            if (bool2) {
              break label726;
            }
            if (!bool1) {}
          }
          else
          {
            paramo.a(localObject1, (k)localObject2);
          }
        }
        break label702;
      }
      if (bool2) {
        break label727;
      }
    }
    if (this.s == 0)
    {
      localObject1 = paramo.c(ed.a);
      localObject2 = this.j.keySet().iterator();
      do
      {
        do
        {
          do
          {
            if (!((Iterator)localObject2).hasNext()) {
              break;
            }
            localObject3 = (d)((Iterator)localObject2).next();
          } while (a((d)localObject3, (k)localObject1));
          paramo.a((d)localObject3, a.d.w.c);
          if (bool2) {
            break label642;
          }
          if ((!bool2) && (bool1)) {
            break label619;
          }
        } while (bool2);
      } while (!bool1);
      localObject1 = paramo.c(ed.b);
      label619:
      localObject2 = this.k.keySet().iterator();
      label642:
      do
      {
        do
        {
          do
          {
            if (!((Iterator)localObject2).hasNext()) {
              break;
            }
            localObject3 = (d)((Iterator)localObject2).next();
          } while (a((d)localObject3, (k)localObject1));
          paramo.b((d)localObject3, a.d.w.c);
          if ((bool2) || (bool2)) {
            break label734;
          }
          if (bool1) {
            break label731;
          }
        } while (bool2);
      } while (!bool1);
    }
    label702:
    localh.e();
    paramo.a(localn);
    this.i = null;
    this.j = null;
    this.k = null;
    label726:
    label727:
    this.l = null;
    label731:
    label734:
    if ((bool2) || (q.n))
    {
      if (!bool2) {}
      h.i = !bool1;
    }
    if (q.o) {
      h.j = !bool2;
    }
  }
  
  boolean a(d paramd, k paramk)
  {
    boolean bool = h.j;
    if (!bool) {
      if (paramk == null) {
        return false;
      }
    }
    if (!bool) {
      if (!(paramk.get(paramd) instanceof cd)) {
        return false;
      }
    }
    return ((cd)paramk.get(paramd)).a();
  }
  
  private void a(h paramh, c_ paramc_)
  {
    boolean bool2 = h.j;
    boolean bool1 = h.i;
    bb localbb = new bb();
    Object localObject1 = paramh.c(paramh.d()).l();
    Object localObject2;
    do
    {
      if (!((a.c.w)localObject1).e()) {
        break;
      }
      localObject2 = ((a.c.w)localObject1).d();
      if (bool1) {
        break label92;
      }
      if (paramh.e((e)localObject2)) {
        localbb.add(localObject2);
      }
      ((a.c.w)localObject1).f();
    } while (!bool1);
    label92:
    do
    {
      e locale;
      do
      {
        if ((!bool2) && (localbb.isEmpty())) {
          break;
        }
        localObject1 = localbb.o();
        do
        {
          if (!bool2)
          {
            if (paramc_.a((e)localObject1)) {
              paramc_.b((e)localObject1);
            }
          }
          else {
            if (!bool1) {
              break;
            }
          }
          localObject2 = paramh.c((e)localObject1).l();
          ((a.c.w)localObject2).i();
          if (!((a.c.w)localObject2).e()) {
            break;
          }
          locale = ((a.c.w)localObject2).d();
        } while (bool2);
      } while (bool1);
      if (paramh.e(locale)) {
        localbb.c(locale);
      }
      ((a.c.w)localObject2).g();
    } while (!bool1);
  }
  
  private static abstract interface c_
  {
    public abstract boolean a(e parame);
    
    public abstract void b(e parame);
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.c.b

 * JD-Core Version:    0.7.0.1

 */